package game.web.entity;

import game.web.dao.UserDAO;
import game.web.dao.dto.UserDTO;
import game.web.dao.factory.UserFactory;
import projectx.core.base.ProjectXSystemException;
import projectx.core.base.ProjectXUserException;
import projectx.core.dao.Parameter;

public class UserEntityManager {

	public static UserDTO execute(String id) throws ProjectXSystemException,
			ProjectXUserException {
		
		System.err.println("User EntityManager start...id="+id);

		UserFactory factory = UserFactory.getFactory();

		// where
		Parameter param = new Parameter();
		param.setString("userid", id);

		UserDAO dao = factory.getUserDAO();

		UserDTO dto = dao.execute(param);

		return dto;
	}


	public static boolean update(UserDTO dto) throws ProjectXSystemException,
			ProjectXUserException {
			UserFactory factory = UserFactory.getFactory();
			UserDAO dao = factory.getUserDAO();
			return dao.update(dto);
	}
}
